{% extends 'admin/model/list.html' %}
{% block model_menu_bar_after_filters %}
    {{ super() }}
    <li>
        <a href="javascript:void(0)" onclick="get_chk_ids()">批量修改</a>
    </li>
{% endblock %}
{% block tail_js %}
    {{ super() }}
<script src="/static/layer/layer.js?date=7.4.2"></script>
<script src="https://cdn.bootcss.com/echarts/4.2.1-rc1/echarts.min.js"></script>
{% endblock %}
{% block tail %}
    {{ super() }}
<script>
function get_chk_ids(){
    ids=[]
    $('input[type=checkbox][name=rowid]:checked').each(function(){
        ids.push($(this).val());
    });
    if(ids.length>0){
        window.location.href='{{ url_for('.batch_config') }}?ids='+ids.join(',');
    }
    else {
        alert('请选中要批量设置的项目')
    }
}
$(document).ready(function() {
    setInterval(function() {
        arr_uuid=[]
        $('div[type=flow]').each(function(i,itme){
            arr_uuid.push($(this).data('uuid'));
        });
        if(arr_uuid.length>0){
            $.post("{{ url_for('machine.get_cur_flow') }}",{uuids:arr_uuid.join(',')},function(result){
                $.each(result,function(id,value) {
                    $('#fw_down_'+id).html(value[0]);
                    $('#fw_up_'+id).html(value[1]);
                });
            });
        }
    }, 9000);
});

function show_flow_data(id)
{
    $('#show_flow_data_log_id').val(id);
    layer.open({
      type: 2,
        title:'流量信息',
        maxmin: true, //开启最大化最小化按钮
      skin: 'layui-layer-rim',
      area: ['50%', '60%'],
      //offset: 'r',
      content: 'statis_flow_graph?id='+id,
      end: function(){}
    });
}
</script>
{% endblock %}
